import Vue from 'vue'
import App from './App.vue'
import router from './router/router'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import editor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import 'github-markdown-css/github-markdown.css'
import hljs from 'highlight.js'
import axios from 'axios'

axios.defaults.baseURL = 'http://localhost:8764'
axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('Authorization')
  return config
})
Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.use(editor)
Vue.directive('highlight', function (el) {
  const blocks = el.querySelectorAll('pre code')
  blocks.forEach(block => {
    hljs.highlightBlock(block)
  })
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
